package com.pat.java.base.io;

import java.net.*;

public class FindHost {
	public static void main(String[] args) {
		try {
			InetAddress h = InetAddress.getLocalHost();
			System.out.println("toString():" + h.toString());
			System.out.println("getHostName():" + h.getHostName());
			System.out.println("getHostAddress():" + h.getHostAddress());
			h = InetAddress.getByName("liuwenliang-MS-7636");
			System.out.println(h.getHostName() + ":" + h.getHostAddress());
		} catch (UnknownHostException e) {
			System.out.println(e.getMessage());
		}
	}
}
